home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / 4dos / arconv01.zip / COMPSTAT.AWK < prev    next >
Text File  |  1993-06-30  |  1KB  |  52 lines

  1. # This awk script calculates statistics on compression conversions.
  2. # Interpretation: Convertion from x to y appears in row x, column y.
  3. # Written by E.T.C
  4.  
  5. BEGIN {
  6. # No. of compressors, compressors names:
  7.   NOC = 10
  8.   Name[0] = "arj"
  9.   Name[1] = "sqz"
  10.   Name[2] = "ha"
  11.   Name[3] = "zip"
  12.   Name[4] = "arc"
  13.   Name[5] = "zoo"
  14.   Name[6] = "hap"
  15.   Name[7] = "hyp"
  16.   Name[8] = "lzh"
  17.   Name[9] = "hpk"
  18. # Clear calculation tables.
  19.   for (i = 0; i < NOC; i++)
  20.     for (j = 0; j < NOC; j++) {
  21.       In[Name[i], Name[j]] = 0
  22.       Out[Name[i], Name[j]] = 0
  23.     }
  24. }
  25. {
  26.   if ($1 == "#") ;
  27.   else {
  28.     In[$1, $3] += ($2 + 0)
  29.     Out[$1, $3] += ($4 + 0)
  30.   }
  31. }
  32. END {
  33.   printf ("COMP   | ");
  34.   for (i = 0; i < NOC; i++)
  35.     printf ("%3s  | ", Name[i])
  36.   printf ("\n")
  37.   printf ("-------|------|------|------|------|------|------|------|------|------|------|\n")
  38.   for (i = 0; i < NOC; i++) {
  39.     printf (" %3s   |", Name[i]);
  40.     for (j = 0; j < NOC; j++) {
  41.       tin = In[Name[i], Name[j]] + Out[Name[j], Name[i]]
  42.       tout = Out[Name[i], Name[j]] + In[Name[j], Name[i]]
  43.       if (tin == 0)
  44.         printf ("  -   |")
  45.       else
  46.         printf ("%5.2f |", -100 * ((tout / tin) - 1))
  47.     }
  48.     printf ("\n")
  49.   }
  50. }
  51.  
  52.